#include <iostream>
#include <vector>

using std::cout;
using std::endl;
using std::vector;

void test1()
{
    //不能删除连续重复的元素
    vector<int> number = {1, 2, 4, 4, 4, 4, 5, 6, 4, 4, 7};
    for(auto it = number.begin(); it != number.end(); ++it)
    {
        if(4 == *it)
        {
            number.erase(it);
        }
    }

    for(auto it = number.begin(); it != number.end(); ++it)
    {
        cout << *it << "  ";
    }
    cout << endl;
}

void test()
{
    //不能删除连续重复的元素
    vector<int> number = {1, 2, 4, 4, 4, 4, 5, 6, 4, 4, 7};
    for(auto it = number.begin(); it != number.end(); )
    {
        if(4 == *it)
        {
            number.erase(it);
        }
        else
        {
            ++it;
        }
    }

    for(auto it = number.begin(); it != number.end(); ++it)
    {
        cout << *it << "  ";
    }
    cout << endl;
}

int main(int argc, char *argv[])
{
    test();
    return 0;
}

